package com.example.aiquestions.model;

import lombok.Data;
import java.time.LocalDateTime;

@Data
public class ChatSession {
    private String sessionId;
    private String provider;
    private LocalDateTime lastAccessTime;
    private String basePrompt;
    private boolean initialized;
    
    public ChatSession(String sessionId, String provider) {
        this.sessionId = sessionId;
        this.provider = provider;
        this.lastAccessTime = LocalDateTime.now();
        this.initialized = false;
    }
    
    public void updateLastAccessTime() {
        this.lastAccessTime = LocalDateTime.now();
    }
    
    public boolean isExpired(long expirationMinutes) {
        return LocalDateTime.now().minusMinutes(expirationMinutes)
                .isAfter(this.lastAccessTime);
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    public String getProvider() {
        return provider;
    }

    public void setProvider(String provider) {
        this.provider = provider;
    }

    public LocalDateTime getLastAccessTime() {
        return lastAccessTime;
    }

    public void setLastAccessTime(LocalDateTime lastAccessTime) {
        this.lastAccessTime = lastAccessTime;
    }

    public String getBasePrompt() {
        return basePrompt;
    }

    public void setBasePrompt(String basePrompt) {
        this.basePrompt = basePrompt;
    }

    public boolean isInitialized() {
        return initialized;
    }

    public void setInitialized(boolean initialized) {
        this.initialized = initialized;
    }
}